/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Business;

import DataAccess.EnrollEventDataAccess;
import DataAccess.EventDataAccess;
import Entities.RegisterEntities;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author vjphl
 */
@ManagedBean
@RequestScoped
public class EnrollEventBean {

    List<RegisterEntities> registerList;

    RegisterEntities registerEntities;

    String EventId;
    /**
     * Creates a new instance of EnrollEventBean
     */
    public EnrollEventBean() {
        registerList = new ArrayList<RegisterEntities>();
        //registerEntities = new RegisterEntities();
        ViewRegisterByEventId();
    }
    
    public void ViewRegisterByEventId(){
        try {
            if (FacesContext.getCurrentInstance().isPostback()) {
                EventId =FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("eventId");
            }
            EnrollEventDataAccess enrollEventDataAccess = new EnrollEventDataAccess();
            registerList = enrollEventDataAccess.getByEventId("1");
        } catch (Exception ex) {
            Logger.getLogger(EventBean.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public List<RegisterEntities> getRegisterList() {
        return registerList;
    }

    public void setRegisterList(List<RegisterEntities> registerList) {
        this.registerList = registerList;
    }
    
    public RegisterEntities getRegisterEntities() {
        return registerEntities;
    }

    public void setRegisterEntities(RegisterEntities registerEntities) {
        this.registerEntities = registerEntities;
    }
}
